package com.zhangjinghao.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhangjinghao.entity.Resume;
import com.zhangjinghao.entity.SelectArg;
import com.zhangjinghao.mapper.MiddleMapper;
import com.zhangjinghao.mapper.ResumeMapper;
import com.zhangjinghao.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeMapper resumeMapper;
    @Autowired
    private MiddleMapper middleMapper;

    @Override
    public List<Resume> selectList(SelectArg selectArg) {
        return resumeMapper.selectList(selectArg);
    }

    @Override
    public PageInfo<Resume> pageInfo(SelectArg selectArg) {
        PageHelper.startPage(selectArg.getPageNum(),selectArg.getPageSize());
        return new PageInfo<>(resumeMapper.selectList(selectArg));
    }

    @Override
    public int insert(Resume resume) {

        resumeMapper.insert(resume);
        return middleMapper.insert(resume);
    }
}
